//
//  CDcategoryCell.m
//  CuriosityDaily3
//
//  Created by 安林 on 16/9/25.
//  Copyright © 2016年 theBestTeam. All rights reserved.
//

#import "CDcategoryCell.h"

@interface CDcategoryCell()
@property (nonatomic, weak) UIImageView* lefticonView;
@property (nonatomic, weak) UILabel* leftnameLabel;
@property (nonatomic, weak) UIImageView* righticonView;
@property (nonatomic, weak) UILabel* rightnameLabel;

@end

@implementation CDcategoryCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupUI];
    }
    return self;
}
- (void)setupUI{
    //左侧icon
    UIImageView* lefticonView = [[UIImageView alloc] init];
    lefticonView.image = [UIImage imageNamed:@"menu_user@2x.png"];
    [self.contentView addSubview:lefticonView];
    // 左侧name
    UILabel* leftnameLabel = [[UILabel alloc] init];
    leftnameLabel.textColor = [UIColor whiteColor];
    leftnameLabel.text = @"王仙芝";
    leftnameLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:leftnameLabel];
    //右侧icon
    UIImageView* righticonView = [[UIImageView alloc] init];
    righticonView.image = [UIImage imageNamed:@"menu_user@2x.png"];
    
    [self.contentView addSubview:righticonView];
    // 右侧name
    UILabel* rightnameLabel = [[UILabel alloc] init];
    rightnameLabel.textColor = [UIColor whiteColor];
     rightnameLabel.text = @"王祖贤 ";
    rightnameLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:rightnameLabel];
    
    
    
    // 自动布局
    [lefticonView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(10);
        make.left.offset(30);
        make.width.height.offset(30);
    }];
    [leftnameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(lefticonView);
        make.left.equalTo(lefticonView.mas_right).offset(5);
    }];
    righticonView.frame = CGRectMake(self.bounds.size.width / 2 + 10, 10, 30, 30);
    rightnameLabel.frame =CGRectMake(self.bounds.size.width / 2 +45, 10, 100, 30);
//    [righticonView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.offset(10);
//        make.left.equalTo(leftnameLabel.mas_right).offset(10);
//        make.width.height.offset(30);
//        
//    }];
//    [rightnameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(righticonView);
//        make.left.equalTo(righticonView.mas_right).offset(5);
//    }];
    self.lefticonView = lefticonView;
    self.leftnameLabel = leftnameLabel;
    self.righticonView = righticonView;
    self.rightnameLabel = rightnameLabel;
}


@end
